# -*- coding: utf-8 -*-
# @Time     : 2021/12/4 21:16
# @Author   : wljess
# @File     : property属性.py
# @Describe : 
# @Software : PyCharm


class Person:

    def __init__(self, name):
        self.name = name
        self.__age = 18

    @property
    def age(self):
        return self.__age

    @age.setter
    def age(self, value):
        if isinstance(value, int):
            self.__age = value
        else:
            return self.__age

    @age.deleter
    def age(self):
        print("删除属性时执行的代码...")
        del self.__age


obj = Person("李白")
print(obj.age)
obj.age = 38
print(obj.age)
del obj.age
print(obj.age)
